#! /usr/bin/env python
# _*_ coding:UTF-8 _*_
"""
@author:zhh
@Software:PyCharm
@blogs:https://blog.csdn.net/smilehaoh
@time:2020/4/24
生成云测的会员测试数据
"""
from common.connect_db import MyDB

my_db = MyDB()


class Member:
    @staticmethod
    def get_member():
        """

        :return:
        """
        sql = "select username as zr from life_member where id<100 "
        result = my_db.execute_select(select_db='new', db_name='member', sql_text=sql)
        if len(result) > 0:
            return result
        else:
            raise ValueError("没有查询到相关数据")


if __name__ == '__main__':
    member = Member()
    memberid = member.get_member()
    list = []
    for item in memberid:
        a = item[0]
        list.append(a)
    print(list)
    list = str(list)
    list = ','.join(list)
    f = open("C:\\Users\Administrator\Desktop\兼容性测试\会员.txt", "w")
    f.write(
        list
    )
    f.close()
